package com.ja.openchat.ui.chat.ext;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.ja.openchat.R;
import com.zy.openchat.core.model.call.CallManager;
import com.zy.openchat.core.model.message.ChatInfo;
import com.zy.openchat.core.model.user.UserInfo;
import com.ja.openchat.ui.chat.annotation.ExtContextMenuItem;
import com.ja.openchat.ui.chat.ext.core.ConversationExt;


public class VideoCallExt extends ConversationExt {

    /**
     * @param containerView 扩展view的container
     * @param conversation
     */
    @ExtContextMenuItem
    public void call(View containerView, ChatInfo conversation) {
        if(conversation!=null&&!conversation.isGroup()){
            UserInfo userInfo = UserInfo.getUserInfo(conversation.userId());
            if(userInfo!=null){
                CallManager.startC2CNewCall(activity,userInfo);
            }
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    }

    @Override
    public boolean filter(ChatInfo conversation) {
        return conversation==null||conversation.isGroup()||conversation.isMyFovChat()||conversation.isGroupSendChat();
    }

    @Override
    public int priority() {
        return 3;
    }

    @Override
    public int iconResId() {
        return R.drawable.chat_icon_videocall;
//        return R.mipmap.chat_icon_video_call;
    }

    @Override
    public String title(Context context) {
        return context.getString(R.string.video_call_text);
    }

    @Override
    public String contextMenuTitle(Context context, String tag) {
        return title(context);
    }
}
